/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.muni.fi.pa165.bookingmanager.dao;

import cz.muni.fi.pa165.bookingmanager.entities.Hotel;
import cz.muni.fi.pa165.bookingmanager.exceptions.IllegalOrphanException;
import cz.muni.fi.pa165.bookingmanager.exceptions.NonexistentEntityException;
import java.util.List;
import javax.ejb.Local;

/**
 *
 * @author Štefan Repček
 */
@Local
public interface HotelManager {
    
    /**
     * Creates new Hotel in database and sets its ID
     * 
     * @param hotel Hotel object to be created
     * @throws IllegalOrphanException when hotel id is already set
     * @throws IllegalArgumentException when hotel is null
     */    
    public void createHotel(Hotel hotel) throws IllegalOrphanException;
    
    /**
     * Update Hotel in database 
     * 
     * @param hotel Hotel object to be updated
     * @throws IllegalOrphanException when hotel id is null
     * @throws IllegalArgumentException when hotel is null or some of the not-optional arguments of Hotel is missing
     * @throws Exception 
     * @throws NonexistentEntityException when Hotel with set id doesn't exist in database
     */    
    public void updateHotel(Hotel hotel) throws NonexistentEntityException, IllegalOrphanException, Exception;
    
    /**
     * Deletes hotel from database
     * 
     * @param hotel Hotel object to be delete
     * @throws IllegalArgumentException when hotel == null
     * @throws IllegalOrphanException when hotel id is null
     * @throws NonexistentEntityException when Hotel with set id doesn't exist in database
     */   
    public void deleteHotel(Hotel hotel) throws NonexistentEntityException,IllegalOrphanException;
    
    /**
     * Retrieves Hotel by ID
     * 
     * @param hotelId id of the hotel to be retrived
     * @return Hotel object with set ID or null when hotel object doesn't exist 
     */
    public Hotel getHotelById(Long hotelId);
    
     /**
     * Retrieves List of all hotels in database 
     * 
     * 
     * @return List of Hotels object with set ID or empty List when hotels object doesn't exist 
     */    
    public List<Hotel> findAllHotels();
    
    /**
     * Retrieves List of all hotels in database by name
     * 
     * @param name name of the hotel
     * @return List of Hotels object with set ID or empty List when hotels object doesn't exist 
     */    
    public List<Hotel> findHotelsByName(String name);
    
    /**
     * Retrieves List of all hotels in database by city
     *  
     * @param city city of the hotel
     * @return List of Hotels object with set ID or empty List when hotels object doesn't exist 
     */    
    public List<Hotel> findHotelsByCity(String city);
    
}
